package com.wuge.common.group;

import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;
import java.util.HashSet;

public class ShowStatusConstraint implements ConstraintValidator<ListValue,Integer> {
    HashSet<Integer> hashSet=new HashSet<>();
    @Override
    public boolean isValid(Integer integer, ConstraintValidatorContext constraintValidatorContext) {
        for (Integer integer1 : hashSet) {
            if (integer.equals(integer1)){
                return true;
            }
        }
        return false;
    }

    @Override
    public void initialize(ListValue constraintAnnotation) {
        int[] value = constraintAnnotation.value();
        for (int i : value) {
            hashSet.add(i);
        }

    }
}
